/**
 * Cache 工具类
 * @constructor
 */
function CacheUtil() {
}

CacheUtil.cache = {}

CacheUtil.get = (key) => {
  const val = CacheUtil.cache[key]
  console.log(`从缓存中根据key: ${key} 获取值: ${JSON.stringify(val)}`)
  return val
}

CacheUtil.put = (key, val) => {
  console.log(`写缓存key: ${key}; 值: ${JSON.stringify(val)}`)
  CacheUtil.cache[key] = val
}

CacheUtil.remove = (key) => {
  console.log(`从缓存中移除key: ${key}`)
  CacheUtil.cache[key] = undefined
}

module.exports = { CacheUtil }
